/*
 * Created on 2005-6-20
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package com.linkage.lcims.base.dao.system.impl;

import java.util.ArrayList;
import java.util.List;

import com.linkage.lcims.base.dao.HibernateBaseDAOImpl;
import com.linkage.lcims.base.dao.system.interfaces.SyscodeDAO;
import com.linkage.lcims.base.po.system.MdSyscode;
import com.linkage.lcims.base.po.system.MdSyscodePK;
import com.linkage.util.exception.DAOException;

/**
 * @author Administrator
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class SyscodeDAOImpl extends HibernateBaseDAOImpl implements SyscodeDAO {

	/**
	 * 
	 */
	public SyscodeDAOImpl() {
		super();
		// TODO Auto-generated constructor stub
	}

	/* (non-Javadoc)
	 * @see com.linkage.lcims.base.dao.system.interfaces.SyscodeDAO#getAll()
	 */
	@SuppressWarnings("unchecked")
	public List<MdSyscode> getAll() throws DAOException {
		// TODO Auto-generated method stub
		return this.getAll(MdSyscode.class);
	}

	/* (non-Javadoc)
	 * @see com.linkage.lcims.base.dao.system.interfaces.SyscodeDAO#getSyscode(int, int)
	 */
	public MdSyscode getSyscode(int serno, int paramno) throws DAOException {
		// TODO Auto-generated method stub
		return (MdSyscode)this.getByID(MdSyscode.class, new MdSyscodePK(
				new Integer(serno), new Integer(paramno)));
	}

	/* (non-Javadoc)
	 * @see com.linkage.lcims.base.dao.system.interfaces.SyscodeDAO#getSyscodes(int)
	 */
	@SuppressWarnings("unchecked")
	public List<MdSyscode> getSyscodes(int serno) throws DAOException {
		// TODO Auto-generated method stub
		String hql = "from MdSyscode as syscode where syscode.comp_id.serno=:serno order by syscode.comp_id.paramno";
		return this.query(hql, "serno", new Integer(serno));
	}

	/* (non-Javadoc)
	 * @see com.linkage.lcims.base.dao.system.interfaces.SyscodeDAO#saveSyscode(com.linkage.lcims.base.po.system.MdSyscode)
	 */
	public void saveSyscode(MdSyscode syscode) throws DAOException {
		// TODO Auto-generated method stub
		this.save(syscode);
	}

	/* (non-Javadoc)
	 * @see com.linkage.lcims.base.dao.system.interfaces.SyscodeDAO#deleteSyscode(com.linkage.lcims.base.po.system.MdSyscode)
	 */
	public void deleteSyscode(MdSyscode syscode) throws DAOException {
		// TODO Auto-generated method stub
		this.delete(MdSyscode.class, syscode.getComp_id());
	}

	/* (non-Javadoc)
	 * @see com.linkage.lcims.base.dao.system.interfaces.SyscodeDAO#updateSyscode(com.linkage.lcims.base.po.system.MdSyscode)
	 */
	public void updateSyscode(MdSyscode syscode) throws DAOException {
		// TODO Auto-generated method stub
		this.merge(syscode);
	}

}
